package com.dolphin.apipassenger.service;

import com.dolphin.apipassenger.remote.ServiceOrderClient;
import com.dolphin.apipassenger.request.OrderRequest;
import com.dolphin.common.constant.IdentityConstant;
import com.dolphin.common.dto.OrderInfo;
import com.dolphin.common.dto.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ServiceOrderService {
    @Autowired
    private ServiceOrderClient serviceOrderClient;
    public ResponseResult add(OrderRequest orderRequest) {
        return serviceOrderClient.add(orderRequest);
    }
    public ResponseResult book(OrderRequest orderRequest) {
        return serviceOrderClient.book(orderRequest);
    }

    /**
     * 取消订单
     * @param orderId
     * @return
     */
    public ResponseResult cancel(Long orderId) {
        return serviceOrderClient.cancel(orderId, IdentityConstant.PASSENGER_IDENTITY);

    }

    public ResponseResult<OrderInfo> detail(Long orderId){
        return serviceOrderClient.detail(orderId);
    }

    public ResponseResult<OrderInfo> currentOrder(String phone , String identity){
        return serviceOrderClient.currentOrder(phone,identity);
    }

}
